All Questions
2 questions
2votes
2answers
2kviews
How does the CPU access the values of stack-allocated variables? [duplicate]
Consider the following C++ function: void doStuff() { Thing thingA; Thing thingB; thingA.doSomething(); // .. etc } During the execution of this function, variables thingA and thingB ...
42votes
3answers
29kviews
Why does the stack grow downward?
I'm assuming there's a history to it, but why does the stack grow downward? It seems to me like buffer overflows would be a lot harder to exploit if the stack grew upward...